package com.egoonet.web;

import com.egoonet.dao.PostUserRepository;
import com.egoonet.domain.PostUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 主要用于来测试虚拟视图的相关访问操作
 * Created by wchi on 2017/4/21.
 */
@RestController
public class PostUserController {
    @Autowired
    PostUserRepository postUserRepository;

    /**
     * 测试虚拟视图查询
     * @return
     */
    @RequestMapping(value="/postuser/{userName}", method = RequestMethod.GET)
    public List<PostUser> getByUserName(@PathVariable("userName") String userName){
        List<PostUser> postList = postUserRepository.findByUserName(userName);
        return postList;
    }
}
